#!/bin/bash
set -e
set -x
MYDIR="${0%/*}"
cd "$MYDIR/.."
source "recipes/common.sh"


# RECIPE START ninja-native
#
# depends: Python-native

save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
export CFLAGS="-O2 -g"
unset CPPFLAGS
unset LDFLAGS

rm -rf build/ninja-native
mkdir -p build/ninja-native
cd build/ninja-native

env \
	CXX="g++" \
	AR="ar" \
python3 ../../ninja/configure.py \
	--bootstrap

mkdir -p -m755 "${xtools}${build_prefix}/bin"
cp -a ninja "${xtools}${build_prefix}/bin/"
cd ../..

export CFLAGS="$save_CFLAGS"
export CPPFLAGS="$save_CPPFLAGS"
export LDFLAGS="$save_LDFLAGS"

# RECIPE END ninja-native
